/*
* Copyright (C) 2012-2014 qar
* License: http://www.gnu.org/licenses/gpl.html GPL version 2
*/

#include "crypto/hash/hashfunctionsha1.h"

HashFunctionSha1::HashFunctionSha1()
    : qHasher(QCryptographicHash::Sha1)
{}

HashFunctionSha1::~HashFunctionSha1()
{}

qint64 HashFunctionSha1::hashSize() const
{
    return 20;
}

QString HashFunctionSha1::getAlgorithmName() const
{
    return "SHA-1";
}

void HashFunctionSha1::reset()
{
    qHasher.reset();
}

void HashFunctionSha1::addData(const char *data, int length)
{
    qHasher.addData(data, length);
}

QByteArray HashFunctionSha1::result() const
{
    return qHasher.result();
}

QByteArray HashFunctionSha1::offlineHash(const QByteArray &data) const
{
    return QCryptographicHash::hash(data, QCryptographicHash::Sha1);
}
